package cn.itsource.hrm.controller;

import cn.itsource.hrm.service.ISmsCodeService;
import cn.itsource.hrm.util.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/sendSmsCode")
public class SmsCodeController {
    @Autowired
    private ISmsCodeService smsCodeService;
    @PostMapping
    public AjaxResult sendSmsCode(@RequestBody Map<String,Object> params){

        try{
            return smsCodeService.sendSmsCode(params);
        }catch (Exception e){
            e.printStackTrace();
            return AjaxResult.me().setSuccess(false).setMessage("发送失败！"+e.getMessage());
        }
    }
}
